/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function showSearchResult(str){
   
    var xmlhttp=0;
   
    if (str.length == "")
    {
        document.getElementById("display").innerHTML="";
        return ;
    }
    else if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  
    xmlhttp.open("GET","http://127.0.0.1/projects/SSMS/index.php/deleteCourses?q="+str,true);
    xmlhttp.send();
}

$(document).ready(function(){
    $("#submitCourses").validationEngine();
});

$(document).ready(function(){
    $("#submitLecturer").validationEngine();
});

$(document).ready(function(){
    $("#submitStudent").validationEngine();
});

$(document).ready(function(){
    $("#telephone").change(function(){
        if (this.value < 10 || this.value > 15 ){
            $(this).validationEngine("showPrompt","*Invalid! Telephone must have minimum 10 digits","error");
        }
        if (isNaN(this.value)){
            $(this).validationEngine("showPrompt","*Invalid! Not valid Characters, telephone only digits allowed","error");

        }
    });
});

$(document).ready(function(){
    $("#fax").change(function(){
        if (this.value < 10 || this.value > 15 ){
            $(this).validationEngine("showPrompt","*Invalid! fax must have minimum 10 digits","error");
        }
        if (isNaN(this.value)){
            $(this).validationEngine("showPrompt","*Invalid!Not valid Characters, fax only digits allowed","error");

        }
    });
});

$(document).ready(function(){
    $("#studentEmail").change(function(){
        if (!((this.value.indexOf(".") > 0) & (this.value.indexOf("@") > 0)) || /[^a-zA-Z0-9.@_-]/.test(this.value)){
            $(this).validationEngine("showPrompt","Invalid! The Email address is invalid","error");
        }
    });
});

$(document).ready(function(){
    $("#email").change(function(){
        if (!((this.value.indexOf(".") > 0) & (this.value.indexOf("@") > 0)) || /[^a-zA-Z0-9.@_-]/.test(this.value)){
            $(this).validationEngine("showPrompt","Invalid! The Email address is invalid","error");
        }
    });
});
